import sys
import random as r
import pygame as p
p.init()#初始化
screencation=p.display.set_caption('hello world')#标题
screen=p.display.set_mode([640,480])
screen.fill([255,255,255])
for i in range(20):
    color=r.randint(0,255)
    location=r.randint(0,200)
    my_rect=p.Rect(r.randint(0,200),r.randint(0,200),r.randint(0,200),r.randint(0,200))#注意是大写的Rect    p.draw.circle(screen,[color,color,color],[location,location],location,0)
    p.draw.circle(screen,[255,0,0],[100,100],30,0)
    p.draw.rect(screen,[color,color,color],my_rect,0)
p.display.flip()
while True:
    for event in p.event.get():
        if event.type==p.QUIT:
            sys.exit()
